//
//  WYWSessionService.h
//  15WClient
//
//  Created by JinYong on 16/4/24.
//  Copyright © 2016年 15w. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "WYWHTTPSessionManager.h"

/**
 *  HTTP请求类型
 */
typedef NS_ENUM(NSInteger, WYWNetworkRequestMethod) {
    WYWNetworkRequestMethodGET,   //GET
    WYWNetworkRequestMethodPUT,   //PUT
    WYWNetworkRequestMethodPOST,  //POST
    WYWNetworkRequestMethodDELETE //DELETE
};

/**
 *  网络请求下行数据压缩格式
 */
typedef NS_ENUM(NSInteger, WYWNetworkContentEncoding){
    WYWNetworkEncodingNone = 0,   //None (无压缩)
    WYWNetworkEncodingLZSS,   //LZSS (Jacob Ziv、Abraham Lempel、Storer、Szymanski)
    WYWNetworkEncodingGNUZip  //GNUZip (Jean-loupGailly、MarkAdler)
};


typedef void(^WYWRequestSuccessBlock)(NSURLSessionDataTask *dataTask, id responseObj);
typedef void(^WYWRequestFailBlock)(NSError *error);

@interface WYWSessionService : NSObject

+ (NSURLSessionDataTask *)startGetRequest:(NSString *)url
                                     path:(NSString *)path
                                   params:(NSDictionary *)params
                                  success:(WYWRequestSuccessBlock)success
                                  failure:(WYWRequestFailBlock)failure;


+ (NSURLSessionDataTask *)startPostRequest:(NSString *)url
                                      path:(NSString *)path
                                    params:(NSDictionary *)params
                                   success:(WYWRequestSuccessBlock)success
                                   failure:(WYWRequestFailBlock)failure;


+ (NSURLSessionDataTask *)startSpecialRequest:(NSString *)url
                                         path:(NSString *)path
                                       params:(NSDictionary *)params
                                requestMehtod:(WYWNetworkRequestMethod)method
                                     encoding:(WYWNetworkContentEncoding)encoding success:(WYWRequestSuccessBlock)success
                                      failure:(WYWRequestFailBlock)failure
                                    checkData:(BOOL)needCheck
                                   User_Agent:(NSString *)user_agent
                                       Cookie:(NSString *)cookie
                                     httpType:(WYWRequestHeaderType)httpType;

@end
